﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;

namespace Wjs.Controllers.Testing
{
    [RoutePrefix("api/json")]
    public class JsonController : ApiController
    {
        [HttpGet]
        public HttpResponseMessage Get(int id)
        {
            if (id == 1)
            {
                return Request.CreateResponse(HttpStatusCode.OK, new[] 
            {
                new 
                {
                    Id = 1,
                    Name = "Person 1",
                    Age = 10
                },

                new 
                {
                    Id = 2,
                    Name = "Person 2",
                    Age = 20
                },

                new 
                {
                    Id = 3,
                    Name = "Person 3",
                    Age = 30
                }
            });
            }
            
            return Request.CreateResponse(HttpStatusCode.OK, new [] 
            {
                new 
                {
                    Id = 4,
                    Name = "Person 4",
                    Age = 40
                },

                new 
                {
                    Id = 5,
                    Name = "Person 5",
                    Age = 50
                },

                new 
                {
                    Id = 6,
                    Name = "Person 6",
                    Age = 60
                }
            });
        }
    }
}
